package com.java.test.JVM.classLoader;

import java.util.Random;

/**
 * @author TonyOne
 * @version 1.0
 * @desc
 * @date 2018/10/13 10:59
 * @company
 */
public class ClassInitialization {
    public static Random rand = new Random(47);
    @SuppressWarnings("unchecked")
    public static void main(String [] args) throws ClassNotFoundException{
        @SuppressWarnings("unused")
        Class initable = Initable.class;//只是加载字节码进入虚拟机，获得引用没有初始化
        System.out.println("After creating Initable ref");
        System.out.println(Initable.staticFinal);//请求访问static final定值
        System.out.println(Initable.staticFinal2);//请求访问static final 为直接定义的值

        System.out.println(Initable2.stationNonFinal);//访问static的值

        @SuppressWarnings("unused")
        Class initable3 = Class.forName("com.java.test.JVM.classLoader.Initable3");//装载并且初始化
        System.out.println("After creating Initable3 ref");
        System.out.println(Initable3.staticNonFinal);
    }

}
